/*
 * @Description: 描述信息
 * @Version: 版本号
 * @Author: xuebao
 * @Date: 2023-12-11 12:17:43
 * @LastEditors: xuebao
 * @LastEditTime: 2023-12-14 21:26:57
 */



export interface Result<T = any> {
  code: number,
  data: T,
  msg: string
}

export interface ResultData<T = any> {
  list: T[],
  page: {
    pageNum: number,
    pageSize: number,
    total: number | 0,
  }
}

// 接口类型定义
export namespace Login {
  export interface params {
    userName: string
    userPwd: string
  }
}

export interface PageParams {
  pageNum: number,
  pageSize?: number,
}


export namespace User {
  export interface SearchParams {
    userId?: number
    userName?: string
    state?: number
  }
  export interface UserItem {
    "_id": string
    "userId": number,
    "userName": string
    "userEmail": string
    "mobile": string,
    "deptId": string,
    "deptName": string,
    "job": string,
    "state"?: number,
    "role"?: number,
    "roleList"?: [],
    "createId": number,
    userImg?: string
  }
}


export namespace DashBoard {

  export interface ReportData {
    driverCount: number,
    totalMoney: number,
    orderCount: number,
    cityNum: number
  }

  export interface LineData {
    label: string[],
    order: number[],
    money: number[]
  }


  export interface PieData {
    value: number,
    name: string
  }

  export interface RadarData {
    indicator: Array<{ name: string, max: number }>,
    data: {
      name: string,
      value: number[]
    }
  }

  export interface Params extends PageParams {
    userId?: number,
    userName?: string,
    state?: number
  }

  export interface CreateParams {
    userName: string,
    userEmail: string,
    mobile?: number,
    deptId: string,
    job?: string,
    state?: number,
    roleList: string[],
    userImg?: string,
  }

  export interface EditParams extends CreateParams {
    userId: number
  }
}



//部门管理
export namespace Dept {

  export interface Params {
    deptName?: string
  }
  export interface CreateParams {
    deptName: string,
    parentId?: string,
    userName: string
  }
  export interface EditParams extends CreateParams {
    _id: string
  }

  //创建列表需要的
  export interface DeptItem {
    _id: string,
    createTime: string,
    updateTime: string,
    deptName: string,
    parentId: string,
    userName: string,
    children: DeptItem[]
  }
  export interface DelParams {
    _id: string
  }
}


//菜单

export namespace Menu {
  export interface Params {
    menuName: string,
    menuState: string,
  }

  export interface CreateParams {
    menuName: string,//菜单名称
    icon?: string,//菜单图标
    menuType: number,//1菜单 2按钮 3页面
    menuState: number,//1正常 2停用
    menuCode?: string//按钮权限标识
    parentId?: string,//父级菜单ID
    path?: string,//菜单路径
    component?: string//组件名称
    orderBy?: number//组件排序
  }

  //菜单列表
  export interface MenuItem extends CreateParams {
    _id: string,
    createTime: string,
    buttons?: MenuItem[],
    children?: MenuItem[]
  }

  export interface EditParams extends CreateParams {
    _id: string
  }

  //菜单删除

  export interface DelParams {
    _id: string
  }
}



// 角色

export namespace Role {
  export interface Params extends PageParams {
    roleName?: string,
  }
  export interface CreateParams {
    roleName: string
    remark?: string
  }
  export interface RoleItem extends CreateParams {
    _id: string
    permissionList: {
      checkedKeys: string[]
      halfCheckedKeys: string[]
    }
    updateTime: string
    createTime: string
  }

  export interface EditParams extends CreateParams {
    _id: string
  }

  export interface Permission {
    _id: string
    permissionList: {
      checkedKeys: string[]
      halfCheckedKeys: string[]
    }
  }
}


//订单

export namespace Order {
  export enum IState {
    doing = 1,
    done = 2,
    timeout = 3,
    cance = 4
  }


  export interface CreateParams {
    cityName: string
    userName: string
    mobile: number
    startAddress: string //下单开始地址
    endAddress: string //下单结束地址
    orderAmount: number //订单金额
    userPayAmount: number //支付金额
    driverAmount: number //支付金额
    // 1: 微信 2：支付宝
    payType: number //支付方式
    driverName: string //司机名称
    vehicleName: string //订单车型
    // 1: 进行中 2：已完成 3：超时 4：取消
    state: IState // 订单状态
    // 用车时间
    useTime: string
    // 订单结束时间
    endTime: string
  }

  export interface OrderItem extends CreateParams {
    _id: string
    orderId: string //订单ID
    route: Array<{ lng: string; lat: string }>//行驶轨迹
    createTime: string//创建时间
    remark: string//备注
  }

  //搜索参数
  export interface SearchParams {
    orderId?: string,
    userName?: string,
    state?: IState
  }
  //带分页
  export interface Params extends PageParams {
    orderId?: string,
    userName?: string,
    state?: IState
  }

  export interface DictItem {
    id: string,
    name: string
  }

  export interface OrderRoute {
    orderId: string,
    route: Array<{ lng: string; lat: string }>
  }

  // 司机列表
  export interface DriverParams {
    driverName?: string,
    accountStatus?: number
  }
  export enum DriverStatus {
    auth = 0,// 待认证
    normal = 1,//正常
    temp = 2,// 暂时拉黑
    always = 3,// 永久拉黑
    stop = 4 //停止推送
  }
  export interface DriverItem {
    driverName: string // 司机名称
    driverId: number   // 司机ID
    driverPhone: string// 司机手机号
    cityName: string   // 城市名称
    grade: boolean     // 会员等级
    driverLevel: number// 司机等级
    accountStatus: DriverStatus // 司机状态
    carNo: string      // 车牌号
    vehicleBrand: string // 车辆品牌
    vehicleName: string  // 车辆名称
    onlineTime: number   // 昨日在线时长
    driverAmount: number // 昨日司机流水
    rating: number       // 司机评分
    driverScore: number  // 司机行为分
    pushOrderCount: number// 昨日推单数
    orderCompleteCount: number// 昨日完单数
    createTime: string   // 创建时间
  }
}
